clear all

use "Tax_for_Services_Nigeria_final_for_analysis.dta", clear


svyset lga [pweight=sampling_weight], strata(state)

svy: tab nber_hh_members
svy: tab head_of_household
svy: tab schooling
svy: tab occupation
svy: tab income
svy: tab bank_account
svy: tab present_conditions
svy: tab future_conditions
svy: tab occupation income, row

*tabout race sex diabetes using table2.htm, c(row ci) svy f(3) ///
*style(htm) stats(chi2) body font(bold) npos(col) cisep(-) ///
*family(Arial) dropc(6) title(Table 2: My second table) ///
*fn(Some more useful information, perhaps about the sample design)

gen sector = 0 if occupation==1
replace sector = 1 if occupation==5
replace sector = 2 if occupation==2 | occupation==3 | occupation==4 | occupation==6 | occupation==7 | occupation==8

 
gen primary = 0
replace primary = 1 if occupation==1

gen secondary = 0
replace secondary = 1 if occupation==5

gen tertiary = 0
replace tertiary = 1 if occupation==2 | occupation==3 | occupation==4 | occupation==6 | occupation==7 | occupation==8

gen num_child = nber_hh_members - nber_adults_hh_members

egen total_finance_not_health = rowtotal(skipped_healthcare postponed_healthcare not_purchased_healthcare delayed_treatment)

rename trust_heatlh_institutions2 trust_health_institutions2

rename trust_heatlh_institutions trust_health_institutions

global basic "nber_hh_members head_of_household schooling occupation income bank_account present_conditions future_conditions sector"
global healthlist "enrolled_insurance medical_need accessed_healthcare forced_due_to_expenses0 finance_not_access_health able_pay_min affordable_health_dummy confidence_health_clinic_dummy health_status_dummy suffer_chronic_disease trust_state2 trust_health_institutions2 trust_doctors2 trust_state_revenue_service2"
global covlist "trust_state_revenue_service2 total_finance_not_health likelihood_tax_revenue_misuse health_status urban occupation gender head_of_household num_child age_category religion schooling high_educ low_educ bank_account income enrolled_insurance medical_need accessed_healthcare forced_due_to_expenses0 finance_not_access_health able_pay_min affordable_health_dummy confidence_health_clinic_dummy health_status_dummy suffer_chronic_disease tin paid_tax receive_social_benefits service_satisfaction tax_officials_corruption state_for_people state_government_corruption tax_officials_collect_fairly trust local_accountability local_responsiveness political_engagement political_engagement2 tax_burden noncompliance noncompliance_enforcement2"
*global covlist "urban rural trader agri artisan domwork prof unskill busi female male high_educ mid_educ low_educ bank nobank income1 income2 income3 income4 wealth1 wealth2 wealth3 wealth4 wealth5 total_finance_not_health0 total_finance_not_health1 total_finance_not_health2 total_finance_not_health3 total_finance_not_health4 likelihood_tax_revenue_misuse_no likelihood_tax_revenue_misuse_somewhat likelihood_tax_revenue_misuse_yes health_status1 health_status2 health_status3 health_status4 health_status5"
global taxlist_bi "tin paid_tax receive_social_benefits service_satisfaction tax_officials_corruption state_government_corruption local_accountability local_responsiveness political_engagement political_engagement2"
global taxlist_ord "state_for_people1 state_for_people2 state_for_people3 tax_officials_collect_fairly1 tax_officials_collect_fairly2 trust1 trust2 trust3 trust4 trust5 primary secondary tertiary"
global benefit "suffer_chronic_disease accessed_healthcare enrolled_insurance confidence_health_clinic_dummy trust_health_institutions"
global benefit2 "suffer_chronic_disease accessed_healthcare enrolled_insurance confidence_health_clinic_dummy trust_health_institutions2"
global legitimacy "service_satisfaction political_engagement receive_social_benefits paid_tax local_responsiveness local_accountability"

label var confidence_health_clinic_dummy "(Binary) How confident are you that the community health clinic?"

recode nber_hh_members (-666 = .) 


*********************************
*Descriptive Statistics*
*********************************

*Summary statistics
*not present language_group age_group
*label

tab schooling, gen (sch)

global basic "nber_hh_members head_of_household gender urban sch1 sch2 sch3 sch4 sch5 sch6 enrolled_insurance medical_need business_registration market_taxes land_use tenement_rates"

*********************************
*Table A1*
*********************************

sutex $basic  ///
	, file (sumstat_basic.tex) digits (2) minmax nobs replace

	
*********************************
*Figure A1-A9*
*********************************

graph hbar [aw=sampling_weight], over(income, label(labsize(small))) title("Average monthly personal income (Naira)", size(medium)) scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white)) ytitle(,size(small)) ylabel(,labsize(small)) 
graph export "Nigeria_income.pdf",replace

graph hbar [aw=sampling_weight], over(affordable_health, label(labsize(small))) title("Health services are affordable to me", size(medium)) scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white)) ytitle(,size(small)) ylabel(,labsize(small))
graph export "Nigeria_affordable.pdf",replace

graph hbar [aw=sampling_weight], over(noncompliance, label(labsize(small))) title("Which of the following options is closest to" "what you think about people who evade taxes?", size(medium)) scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white)) ytitle(,size(small)) ylabel(,labsize(small))
graph export "Nigeria_noncompliance.pdf",replace

graph hbar [aw=sampling_weight], over(tax_burden, label(labsize(small))) title("What is your opinion about how much tax" "you are required to pay?", size(medium)) scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white)) ytitle(,size(small)) ylabel(,labsize(small)) 
graph export "Nigeria_burden.pdf",replace

graph hbar [aw=sampling_weight], over(not_justified_tax_evasion, label(labsize(small))) title("Tax evasion is never justified", size(medium)) scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white)) ytitle(,size(small)) ylabel(,labsize(small)) 
graph export "Nigeria_taxevasion.pdf",replace

graph hbar [aw=sampling_weight], over(easy_noncompliance, label(labsize(small))) title("How easy do you think it is for people like yourself " "to avoid paying taxes", size(medium)) scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white)) ytitle(,size(small)) ylabel(,labsize(small)) 
graph export "Nigeria_easynoncompliance.pdf",replace

graph hbar [aw=sampling_weight], over(tax_evasion_penalties, label(labsize(small))) title("How high do you think the penalty for tax evasion is?", size(medium)) scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white)) ytitle(,size(small)) ylabel(,labsize(small)) 
graph export "Nigeria_penalty.pdf",replace

foreach i in trust_state trust_state_revenue_service trust_health_institutions trust_doctors{
replace `i' =. if `i'==-999
replace `i' =. if `i'==-888
}

label var trust_state "Trust in State Goverment"
label var trust_state_revenue_service "Trust in State Revenue Service"
label var trust_health_institutions "Trust in Health Institution"
label var trust_doctors "Trust in Doctors"


foreach i in trust_state trust_state_revenue_service trust_health_institutions trust_doctors{
catplot `i' [aweight=sampling_weight], name(t1_`i') percent vertical graphregion(fcolor(white))
}


graph combine t1_trust_state t1_trust_state_revenue_service t1_trust_health_institutions t1_trust_doctors, scheme(s2mono) graphregion(fcolor(white) ilcolor(white) lcolor(white))
graph export "Nigeria_trust.pdf",replace


